import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
import _createClass from "@babel/runtime/helpers/esm/createClass";
import _inherits from "@babel/runtime/helpers/esm/inherits";
import _createSuper from "@babel/runtime/helpers/esm/createSuper";
import _applyDecoratedDescriptor from "@babel/runtime/helpers/esm/applyDecoratedDescriptor";

var _dec, _dec2, _dec3, _class, _class2;

import React from 'react';
import { Bind } from 'lodash-decorators';
import { Button, Col, Form, Input, Row } from 'antd';
import Lov from 'components/Lov';
import intl from 'utils/intl';
import { FORM_COL_4_LAYOUT, SEARCH_FORM_ITEM_LAYOUT, SEARCH_FORM_ROW_LAYOUT } from 'utils/constants';
import { isTenantRoleLevel } from 'utils/utils';
var SearchForm = (_dec = Form.create({
  fieldNameProp: null
}), _dec2 = Bind(), _dec3 = Bind(), _dec(_class = (_class2 = /*#__PURE__*/function (_React$Component) {
  _inherits(SearchForm, _React$Component);

  var _super = _createSuper(SearchForm);

  function SearchForm() {
    _classCallCheck(this, SearchForm);

    return _super.apply(this, arguments);
  }

  _createClass(SearchForm, [{
    key: "handleSearch",
    value: function handleSearch() {
      var _this$props = this.props,
          form = _this$props.form,
          onSearch = _this$props.onSearch;
      onSearch(form);
    }
  }, {
    key: "handleReset",
    value: function handleReset() {
      var form = this.props.form;
      form.resetFields();
    }
  }, {
    key: "render",
    value: function render() {
      var form = this.props.form;
      return /*#__PURE__*/React.createElement(Form, {
        className: "more-fields-search-form"
      }, /*#__PURE__*/React.createElement(Row, Object.assign({}, SEARCH_FORM_ROW_LAYOUT, {
        type: "flex",
        gutter: 12,
        align: "bottom"
      }), !isTenantRoleLevel() && /*#__PURE__*/React.createElement(Col, FORM_COL_4_LAYOUT, /*#__PURE__*/React.createElement(Form.Item, Object.assign({}, SEARCH_FORM_ITEM_LAYOUT, {
        label: intl.get('entity.tenant.tag').d('租户')
      }), form.getFieldDecorator('tenantId')( /*#__PURE__*/React.createElement(Lov, {
        code: "CPFM.TENANT"
      })))), /*#__PURE__*/React.createElement(Col, FORM_COL_4_LAYOUT, /*#__PURE__*/React.createElement(Form.Item, Object.assign({}, SEARCH_FORM_ITEM_LAYOUT, {
        label: intl.get('cmsg.common.view.accountCode').d('账户代码')
      }), form.getFieldDecorator('serverCode')( /*#__PURE__*/React.createElement(Input, {
        typeCase: "upper",
        trim: true,
        inputChinese: false
      })))), /*#__PURE__*/React.createElement(Col, FORM_COL_4_LAYOUT, /*#__PURE__*/React.createElement(Form.Item, Object.assign({}, SEARCH_FORM_ITEM_LAYOUT, {
        label: intl.get('cmsg.common.view.accountName').d('账户名称')
      }), form.getFieldDecorator('serverName')( /*#__PURE__*/React.createElement(Input, null)))), /*#__PURE__*/React.createElement(Col, Object.assign({}, FORM_COL_4_LAYOUT, {
        className: "search-btn-more"
      }), /*#__PURE__*/React.createElement(Form.Item, null, /*#__PURE__*/React.createElement(Button, {
        onClick: this.handleReset
      }, intl.get('cpaas.common.button.reset').d('重置')), /*#__PURE__*/React.createElement(Button, {
        type: "primary",
        htmlType: "submit",
        onClick: this.handleSearch
      }, intl.get('cpaas.common.button.search').d('查询'))))));
    }
  }]);

  return SearchForm;
}(React.Component), (_applyDecoratedDescriptor(_class2.prototype, "handleSearch", [_dec2], Object.getOwnPropertyDescriptor(_class2.prototype, "handleSearch"), _class2.prototype), _applyDecoratedDescriptor(_class2.prototype, "handleReset", [_dec3], Object.getOwnPropertyDescriptor(_class2.prototype, "handleReset"), _class2.prototype)), _class2)) || _class);
export { SearchForm as default };